/* 
 * File:   playListEntry.h
 * Author: hao
 *
 * Created on 2011年5月9日, 上午12:17
 */

#ifndef PLAYLISTENTRY_H
#define	PLAYLISTENTRY_H

#include <qt4/QtGui/QListWidgetItem>
#include <qt4/QtCore/QString>
#include "CueParser.h"

class playListEntry : public QListWidgetItem {
public:
    playListEntry(const QString & str);
    playListEntry( unsigned sheetIndex, unsigned index);
    virtual ~playListEntry();

    enum EntryType {
        FILETYPE, TRACKTYPE
    };

    EntryType getType() const {
        return type;
    }

    unsigned getTrackSheetIndex() const {
        if (type != TRACKTYPE) return 0;
        return Track.sheetindex;
    }

    unsigned getTrackIndex() const {
        if (type != TRACKTYPE) return (unsigned) - 1;
        return Track.index;
    }

    const QString * getPath() const {
        if (type != FILETYPE) return 0;
        return &path;
    }

private:

    struct {
        unsigned sheetindex;
        unsigned index;
    } Track;

    QString path;

    EntryType type;

};

#endif	/* PLAYLISTENTRY_H */

